<template>
	<view>
		<u-navbar :background="background" :borderBottom="false">
			<view class="fw-b ft_16">
				兑换成功
			</view>
		</u-navbar>
		<view class="content ">
			<view class="con_1">
				<view class="p_bottom_10">
					<image src="../../../static/index/index/success.png"></image>
				</view>
				<view class="ft_20 c-333 fw-b p_bottom_10">
					兑换成功
				</view>
			</view>
			<view class="card display just_space">
				<view class=""> 
					<view class=" text_hidden1 ft_16 fw-b" style="width: 90%;">
						{{addressInfo.addresss}}
					</view>
					<view class="p_top_10 c-999">
						<text class="p_right_10">{{addressInfo.name}}</text>
						<text>{{addressInfo.mobile}}</text>
					</view>
				</view>
				<u-icon name="arrow-right" color="#999999" size="28"></u-icon>
			</view>
			<view class="con_2 card">
				<view class="p_bottom_10 ft_12" style="border-bottom: 1px solid #eeeeee;">
					订单编号：{{ordernum}}
				</view>
				<view class="display shopinfo p_top_10">
					<view class="shopimg">
						<image :src="shopinfo.image" mode="aspectFill"></image>
					</view>
					<view class="shoptext">
						<view class="">
							<view class="fw-b text_hidden2">{{shopinfo.name}}</view>
							<view class="ft_12 c-999 p_top_10">
								{{shopinfo.item_name}}
							</view>
						</view>
						<view class="ft_14 fw-b">
							<text class="ft_20" style="color: #E67920;">{{shopinfo.price}}积分</text>
						</view>
					</view>
				</view>
			</view>
			
			
		</view>
		<view class="confirmBtn" @click="backIndex">
			返回首页
		</view>
		
	</view>
</template>

<script>
	export default {
		data() {
			return {
				background:{backgroundColor: '#fafafa',},
				addressInfo:{ //收货地址
					address:"山东省济南市历下区XX街道XX巷XX号XX楼2201",
					name:'白小纯',
					phone:"17888888888"
				},
				shopinfo:{
					bianhao:"20211104135946",
					image:"/static/index/index/zhu.png",
					title:"猪前腿肉500g 带膘猪腿生鲜猪肉 前尖猪腿鲜嫩肉",
					spec_name:"500g",
					number:"2",
					jifen:"9800"
				},
				shopid:6, //商品id
				ordernum:'', //订单id
				
			};
		},
		onBackPress() { //监听返回
			this.backIndex()
			return true
		},
		onLoad(e) {	
			console.log(e);
			if(e.shopid){
				this.shopid=e.shopid
				this.ordernum=e.ordernum
			}
			this.getshopInfo() //获取商品跟地址信息
		},
		methods:{
			getshopInfo(){ //获取商品跟地址信息
				this.$myRequest('order/confirm_integral',{
					goods_id:this.shopid
				}).then(res=>{
					console.log(res.data.data);
					let data=res.data.data
					let address=data.address //默认地址
					address.addresss=address.province_name+address.city_name+address.area_name+address.address
					this.addressInfo=data.address
					
					this.shopinfo= Object.assign(data.goods, data.sku_product)
					this.shopinfo.item_name=this.shopinfo.item_name.replace(/;/g,' ') //去掉分号
					console.log(this.shopinfo);
				})
			},
			backIndex(){ //返回首页
				uni.switchTab({
					url:"../../../../pages/index/index"
				})
			},
			
		},
		
	}
</script>

<style lang="scss">
page{
	background-color: #fafafa;
}
.content{
	padding-top: 5px;
	.card{
		padding: 15px;
		background-color: #FFFFFF;
		margin-bottom: 5px;
	}
	.con_1{
		padding: 15px;margin-bottom: 5px;
		text-align: center;
		image{
			width: 90px;height: 90px;
		}
	}
	.shopinfo{
		position: relative;
		border-bottom: 1px solid #eeeeee;
		padding-bottom: 15px;
		.shopimg{
			width: 200rpx;height: 200rpx;margin-right: 10px;
			image{
				width: 200rpx;height: 200rpx;border-radius: 5px;
			}
		}
		.shoptext{
			display: flex;justify-content: space-between;flex-flow: column;height: 100px;
		}
		.shanc{
			width: 32rpx;height: 32rpx;position: absolute;top: 15px;right: 15px;
		}
	}
	
}
.confirmBtn{
	background: linear-gradient(90deg, #F1A421 0%, #E4741F 100%);margin: 0 20px;padding: 15px 0;color: #FFFFFF;border-radius: 30px;text-align: center;position: fixed;bottom: 80px;width: 335px;
}

</style>
